package com.gohome.gohomechat.model.entify;

import com.gohome.gohomechat.utils.PinYinUtils;

/**
 * Created by dllo on 16/3/1.
 */
public class Friend implements Comparable<Friend> {
    private String userName;
    private String head;
    private String pinyin;

    public Friend() {
    }

    public Friend(String userName, String head) {
        this.userName = userName;
        this.head = head;
        pinyin = PinYinUtils.getPinYin(userName).toUpperCase();

        if (!pinyin.substring(0, 1).matches("[A-Z]")) {
            pinyin = "#" + pinyin;
        }
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getHead() {
        return head;
    }

    public void setHead(String head) {
        this.head = head;
    }

    public String getPinyin() {
        return pinyin;
    }

    public void setPinyin(String pinyin) {
        this.pinyin = pinyin;
    }

    @Override
    public int compareTo(Friend another) {
        return this.pinyin.compareTo(another.getPinyin());
    }
}
